//
//  MathLabel.swift
//  CrseAsst
//
//  Created by 申铭 on 2024/3/5.
//

import Foundation
import SwiftUI
import iosMath

struct MathLabel: UIViewRepresentable {
    let text: String
    let fontSize: CGFloat
    
    func makeUIView(context: Context) -> MTMathUILabel {
        let label = MTMathUILabel()
        label.latex = text
        label.fontSize = fontSize
        label.textAlignment = .center
        label.textColor = .label
        return label
    }
        
    //From SwiftUI To UIKit
    func updateUIView(_ uiView: MTMathUILabel, context: Context) {
        uiView.latex = text
    }
}
